package org.struts.util;

import java.lang.reflect.Field;

import javax.servlet.http.HttpServletRequest;

import org.struts.form.ActionForm;

public class FullBean {

	public static ActionForm full(HttpServletRequest req,String formClass) {
		ActionForm form=null;
		 if(formClass!=null&&formClass.length()>0){
			 try {
				 Class clazz = Class.forName(formClass);
				 form=	(ActionForm)clazz .newInstance();
				 Field[] fields = clazz.getDeclaredFields();
				 for(Field f :fields){
					 f.setAccessible(true);
					 f.set(form, req.getParameter(f.getName()));
					 f.setAccessible(false);
				 }
			} catch (Exception e) {
				e.printStackTrace();
			}
		 }
		 System.out.println(form);
		return form;
	}
           
}
